<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品标签</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../module/inventory/scripts/jquery.js"></script>
<script src="../module/inventory/scripts/jquery.easyui.min.js" type="text/javascript"></script>
<link href="../module/inventory/css/admin/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../module/inventory/css/admin/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../module/inventory/scripts/easyui-lang-zh_CN.js" type="text/javascript"></script>
<style>

</style>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>设置楼层关键字</h3>
            </div>
        </div>
        <div class="h35"></div>
		
		<table id="keywordsList" class="easyui-datagrid" title="标签: <{$tagInfo.tags}>" data-options="rownumbers:true,fitColumns:true,singleSelect:true">
	      <thead>
				<tr>
					<th data-options="field:'name',width:180,align:'center'">名称</th>
					<th data-options="field:'url',width:380,align:'center'">链接</th>
					<th data-options="field:'is_highlight_text',width:80,align:'center'">是否高亮</th>
					<th data-options="field:'is_highlight',width:80,align:'center',hidden:true"></th>
					<th data-options="field:'displayorder',width:80,align:'center'">顺序</th>
					<th data-options="field:'is_display_text',width:120,align:'center'">是否显示</th>
					<th data-options="field:'is_display',width:120,align:'center',hidden:true">是否显示</th>
					<th data-options="field:'update_time',width:220,align:'center'">最后操作时间</th>
				</tr>
			</thead>
		 </table>
    </div>
	
	<div id="addKeywordsPannel" class="easyui-dialog" title="添加楼层关键字" data-options="iconCls:'icon-add',closed: true,modal: true,top:80"  style="width:300px;height:300px;padding:10px">
             <form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
			<table cellpadding="5">
                <tr>
                    <td>名称:<input type="hidden" name="id"></input></td>
                    <td><input class="easyui-textbox" type="text" name="name" data-options="required:true,width:210"></input></td>
                </tr>
				<tr>
                    <td>链接:</td>
                    <td><input class="easyui-textbox" type="text" name="url" data-options="required:true,width:210"></input></td>
                </tr>
				<tr>
                    <td>排序:</td>
                    <td><input class="easyui-textbox" type="text" name="displayorder" data-options="required:true,validType:'number',width:210"></input></td>
                </tr>
				<tr>
                    <td>高亮:</td>
                    <td>
                    	<select class="easyui-combobox" name="is_highlight" data-options="required:true,width:210">
                    		<option value="0">否</option>
							<option value="1">是</option>
						</select>
                    </td>
                </tr>
				<tr>
                    <td>显示:</td>
                    <td>
                    	<select class="easyui-combobox" name="is_display" data-options="required:true,width:210">
                    		<option value="0">否</option>
							<option value="1">是</option>
						</select>
                    </td>
                </tr>
				<tr>
					<td colspan="2" style="text-align:center">
						<button type="submit" class="easyui-linkbutton" data-options="iconCls:'icon-save',width:100,height:30" style="margin-top:10px"/>保存</button>
					</td>
				</tr>
			</table>
			</form>
    </div>
	
</body>
<script>
	var tagId = <{$tagInfo.id}>;
	$(function(){
		var keywordsList =$('#keywordsList');
		var addKeywordsPannel = $('#addKeywordsPannel');
		
		keywordsList.datagrid(
			<{$keywords}>
		);
		
		keywordsList.datagrid({
			toolbar: [{
				text:'添加关键词',
				iconCls: 'icon-add',
				handler: function(){
					addKeywordsPannel.dialog({title:"添加关键词"});
					 $('#ff').form('clear');
					 $('#ff').form('load',{is_display:1,is_highlight:0});
					addKeywordsPannel.dialog('open');
				}
			}],
			onDblClickRow:function(index,rows){
				addKeywordsPannel.dialog({title:"编辑关键词"});
				$('#ff').form('load',rows);
				addKeywordsPannel.dialog('open');
			}
		});
		
		$('#ff').form('submit',{
                onSubmit:function(){
					if(!$(this).form('enableValidation').form('validate')){
						return false;
					}
					var data = {};
					data.kid = $('#addKeywordsPannel input[name="id"]').val();
					data.name = $('#addKeywordsPannel input[name="name"]').val();
					data.url = $('#addKeywordsPannel input[name="url"]').val();
					data.displayorder = $('#addKeywordsPannel input[name="displayorder"]').val();
					data.is_highlight = $('#addKeywordsPannel input[name="is_highlight"]').val();
					data.is_display = $('#addKeywordsPannel input[name="is_display"]').val();
					$.post('/admin/module.php?m=product&s=product_tags_floor.php&act=keywords&editid='+tagId,data,function(res){
						if(res.code!='0'){
							alert(res.msg);
						}else{
							window.location.reload();
						}
					},'json');
                }
            });
	});	
	
		
	

</script>
</html>